// import Vue from 'vue'
import { server } from '@/api/index'
import {
    GET_FOOTER_DATA,
    GET_HOME_DATA,
    GET_HOME_NEW_DATA,
    GET_LET_LIST_DATA,
    GET_CAROUSEL_LIST,
    GET_HOT_DESTINATION,
    GET_QUARTER_CONTENT,
    GET_THEM_CONTENT,
    GET_GLOBAL_PLACE,
    GET_NAV_LIST_DATA,
    GET_RANKING,
    GET_INTRODUCTION,
    GET_RANKING_NAV,
    GET_SCENIC_PRICE,
    GET_THEME_REC,
    GET_SPECIAL_PRICE,
    GET_ACC_LIST,
    GET_SPE_HOTEL,
} from './mutation-types'

export default {
    //底部版权
    async reqFooterData({ commit }) {
        const result = await server.getFooterData();
        commit(GET_FOOTER_DATA, { topList: result.top, midList: result.mid, bottomList: result.bottom, endList: result.end })
    },

    //首页热门
    async reqHomeData({ commit }) {
        const result = await server.getHomeData();
        commit(GET_HOME_DATA, { homeList: result })
    },

    //首页轮播
    async reqCarouselList({ commit }) {
        const result = await server.getCarouselList();
        commit(GET_CAROUSEL_LIST, { carouselList: result })
    },

    //首页最新
    async reqHomeNewData({ commit }) {
        const result = await server.getHomeNewData();
        commit(GET_HOME_NEW_DATA, { homeNewList: result })
    },
    //首页侧边列表
    async reqLetListData({ commit }) {
        const result = await server.getLetListData();
        commit(GET_LET_LIST_DATA, { letListData: result })
    },

    //目的地 热门目的地
    async reqHotDestination({ commit }) {
        const result = await server.getHotDestination();
        commit(GET_HOT_DESTINATION, { hotDestinationList: result })
    },
    //目的地 当季
    async reqQuarterContent({ commit }) {
        const result = await server.getQuarterContent();
        commit(GET_QUARTER_CONTENT, { quarterContent: result })
    },
    //目的地 主题
    async reqThemeContent({ commit }) {
        const result = await server.getThemeContent();
        commit(GET_THEM_CONTENT, { themeContent: result })
    },

    //目的地最下面的全球目的地
    async reqGlobalPlace({ commit }) {
        const result = await server.getGlobalPlace();
        commit(GET_GLOBAL_PLACE, { globalPlace: result })
    },


    //旅游攻略
    async reqNavDataList({ commit }) {
        const result = await server.getNavListData();
        commit(GET_NAV_LIST_DATA, { navDataList: result })
    },

    //旅游攻略 左侧排行榜
    async reqRanking({ commit }) {
        const result = await server.getRanking();
        commit(GET_RANKING, { ranking: result })
    },

    //旅游攻略 右侧文章
    async reqIntroduction({ commit }) {
        const result = await server.getIntroduction();
        commit(GET_INTRODUCTION, { introduction: result })
    },

    //旅游攻略 左侧排行榜 导航
    async reqRankingNav({ commit }) {
        const result = await server.getRankingNav();
        commit(GET_RANKING_NAV, { rankingNav: result })
    },

    //去旅行  热门景点 价格
    async reqScenicPrice({ commit }) {
        const result = await server.getScenicPrice();
        commit(GET_SCENIC_PRICE, { scenicPriceList: result })
    },

    //去旅行 主题推荐 景点
    async reqThemeRec({ commit }) {
        const result = await server.getThemeRec();
        commit(GET_THEME_REC, { themeRecList: result })
    },

    //机票火车票  下面特价票列表
    async reqSpecialPrice({ commit }) {
        const result = await server.getSpecialPrice();
        commit(GET_SPECIAL_PRICE, { specialPriceList: result })
    },

    //订酒店页面 主题住宿
    async reqAccList({ commit }) {
        const result = await server.getAccList();
        commit(GET_ACC_LIST, { accList: result })
    },

    //订酒店页面 特价酒店
    async reqSpeHotel({ commit }) {
        const result = await server.getSpeHotel();
        commit(GET_SPE_HOTEL, { speHotel: result })
    },
}